package com.gitee.cliveyuan.tools.http;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by clive at 2018/11/27.
 */
public class HttpResp {

    private int statusCode = 200;
    private String content;
    private Map<String, String> cookies = Maps.newHashMap();
    private Map<String, String> headers = Maps.newHashMap();

    public HttpResp() {
    }

    public HttpResp(String content) {
        this.content = content;
    }

    public HttpResp(String content, Map<String, String> cookies, Map<String, String> headers) {
        this.content = content;
        this.cookies = cookies;
        this.headers = headers;
    }

    public static HttpResp create() {
        return new HttpResp();
    }

    public static HttpResp create(String content) {
        return new HttpResp(content);
    }


    public static HttpResp create(String content, Map<String, String> cookies, Map<String, String> headers) {
        return new HttpResp(content, cookies, headers);
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Map<String, String> getCookies() {
        return cookies;
    }

    public void setCookies(Map<String, String> cookies) {
        this.cookies = cookies;
    }

    public void addCookie(String key, String value) {
        this.cookies.put(key, value);
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    public void addHeader(String key, String value) {
        this.headers.put(key, value);
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }
}
